package com.vtech.mybatis.baseservice.plugins;

import com.vtech.mybatis.baseservice.base.AbstractBatch;

/**
 * TODO
 *
 * @author houzhiwei
 * @date 2016/11/7 21:07.
 */
public class BatchMethodsSqlMap extends AbstractBatch {
    public String getDbType() {
        return dbType;
    }

    public void setDbType(String dbType) {
        this.dbType = dbType;
    }

    private String dbType;

    @Override
    protected String getColumnsSuffix() {
        if ("oracle".equalsIgnoreCase(dbType)) {
            return ")";
        } else {
            return ") VALUES";
        }
    }

    @Override
    protected String getValuesPrefix() {
        if ("oracle".equalsIgnoreCase(dbType)) {
            return "( SELECT";
        } else {
            return "(";
        }
    }

    @Override
    protected String getValuesSuffix() {
        if ("oracle".equalsIgnoreCase(dbType)) {
            return "FROM DUAL )";
        } else {
            return ")";
        }
    }

    @Override
    protected String getForeachSeparator() {
        if ("oracle".equalsIgnoreCase(dbType)) {
            return "UNION ALL";
        } else {
            return ",";
        }
    }
}
